
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on Jun 2, 2011, 10:16:15 AM
 */

/**
 *
 * @author cakridge
 */

//public class NewResultsFrame extends javax.swing.JFrame {
public class NewResultsFrame extends javax.swing.JFrame {

    /** Creates new form NewJFrame */
    public NewResultsFrame(XTOOLSResultsFrame results) {
      resultsFrame = results;
      initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jLayeredPane1 = new javax.swing.JLayeredPane();
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTextPane1 = new javax.swing.JTextPane();
    jScrollPane2 = new javax.swing.JScrollPane();
    jTextPane2 = new javax.swing.JTextPane();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem1_newPlot = new javax.swing.JMenuItem();
    jMenuItem2 = new javax.swing.JMenuItem();
    jMenuItem3 = new javax.swing.JMenuItem();
    jMenu3 = new javax.swing.JMenu();

    addWindowListener(new java.awt.event.WindowAdapter() {
      public void windowClosed(java.awt.event.WindowEvent evt) {
        formWindowClosed(evt);
      }
    });

    jTabbedPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0), 3));
    jTabbedPane1.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
    jTabbedPane1.setName("test2"); // NOI18N
    jTabbedPane1.setPreferredSize(new java.awt.Dimension(700, 500));
    jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
      public void mouseExited(java.awt.event.MouseEvent evt) {
        jTabbedPane1MouseExited(evt);
      }
    });

    jScrollPane1.setViewportView(jTextPane1);

    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
      jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
      .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 673, Short.MAX_VALUE)
    );
    jPanel1Layout.setVerticalGroup(
      jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
      .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
    );

    jTabbedPane1.addTab("Gen Best", jPanel1);

    jScrollPane2.setViewportView(jTextPane2);

    jTabbedPane1.addTab("Curr Pop", jScrollPane2);

    jMenu1.setText("File");

    jMenuItem1_newPlot.setText("New Plot");
    jMenuItem1_newPlot.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        jMenuItem1_newPlotActionPerformed_newPlot(evt);
      }
    });
    jMenu1.add(jMenuItem1_newPlot);

    jMenuItem2.setText("Generation Best");
    jMenuItem2.addMouseListener(new java.awt.event.MouseAdapter() {
      public void mouseReleased(java.awt.event.MouseEvent evt) {
        jMenuItem2MouseReleased(evt);
      }
    });
    jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        jMenuItem2ActionPerformed(evt);
      }
    });
    jMenu1.add(jMenuItem2);

    jMenuItem3.setText("Current Population");
    jMenu1.add(jMenuItem3);

    jMenuBar1.add(jMenu1);

    jMenu3.setText("Help");
    jMenuBar1.add(jMenu3);

    setJMenuBar(jMenuBar1);

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
      .add(layout.createSequentialGroup()
        .addContainerGap(88, Short.MAX_VALUE)
        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
          .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
            .add(jLayeredPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addContainerGap())
          .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
            .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 700, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .add(47, 47, 47))))
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
      .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
        .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 500, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 102, Short.MAX_VALUE)
        .add(jLayeredPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
        .add(305, 305, 305))
    );

    jTabbedPane1.getAccessibleContext().setAccessibleName("");

    pack();
  }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem1_newPlotActionPerformed_newPlot(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1_newPlotActionPerformed_newPlot
      graphDialog = new GraphDialog(this, rootPaneCheckingEnabled, resultsFrame.monitor.genGraph.varName, this);
      graphDialog.setVisible(rootPaneCheckingEnabled);
    }//GEN-LAST:event_jMenuItem1_newPlotActionPerformed_newPlot

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
 /*     textArea.setText(bestIndividualInfo);
      textArea.setCaretPosition(textArea.getDocument().getLength());
      mainPanel.removeAll();
      scrollPane.setMinimumSize(new Dimension(485, 430));
      mainPanel.add(scrollPane, BorderLayout.CENTER);
*/
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
      setVisible(false);
    }//GEN-LAST:event_formWindowClosed

    private void jMenuItem2MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItem2MouseReleased
      jTabbedPane1.setVisible(isAlwaysOnTop());
      jTextPane1.setText("TESTING");
    }//GEN-LAST:event_jMenuItem2MouseReleased

    private void jTabbedPane1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane1MouseExited
      // TODO add your handling code here:
      //    setVisible(false);
}//GEN-LAST:event_jTabbedPane1MouseExited

    /**
    * @param args the command line arguments
    */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new NewResultsFrame().setVisible(true);
//            }
//        });
//    }

  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JLayeredPane jLayeredPane1;
  private javax.swing.JMenu jMenu1;
  private javax.swing.JMenu jMenu3;
  private javax.swing.JMenuBar jMenuBar1;
  private javax.swing.JMenuItem jMenuItem1_newPlot;
  private javax.swing.JMenuItem jMenuItem2;
  private javax.swing.JMenuItem jMenuItem3;
  private javax.swing.JPanel jPanel1;
  private javax.swing.JScrollPane jScrollPane1;
  private javax.swing.JScrollPane jScrollPane2;
  protected javax.swing.JTabbedPane jTabbedPane1;
  protected javax.swing.JTextPane jTextPane1;
  protected javax.swing.JTextPane jTextPane2;
  // End of variables declaration//GEN-END:variables
  private GraphDialog graphDialog;
  protected XTOOLSResultsFrame resultsFrame;

}
